<template>
    <div>

    </div>
</template>
<script>
import { onBeforeUnmount, onMounted, onUnmounted } from 'vue'
export default {
    setup() {
        let timer = undefined
        onMounted(() => {
            timer = setInterval(() => { console.log('log');},1000)
        })
        onBeforeUnmount(() => {
            console.log('dom销毁之前');
        })
        onUnmounted(() => {
            console.log('dom销毁之后');
            clearInterval(timer)
        })
        return {}
    }
}
</script>